﻿using System;

namespace MyAMS.WebServer.Models.Extensions
{
    /// <summary>
    /// 路由规则扩展类
    /// </summary>
    public static class RoutingRoleExtensions
    {
        /// <summary>
        /// 指示一个特定的路由规则是否为动态规则
        /// </summary>
        /// <param name="role">路由规则</param>
        /// <returns>true则为动态规则</returns>
        public static bool IsDynamicRole(this RoutingRole role)
        {
            return role.Uri.Length > 2 && String.Compare(role.Uri[0].ToString(), "{", false) == 0 && String.Compare(role.Uri[role.Uri.Length - 1].ToString(), "}") == 0;
        }
    }
}
